﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace SampleTryouts.Models
{
    public class LinqValueCalculator : IValueCalculator
    {
        private IDiscountHelper discounter;

        public decimal ValueProducts(IEnumerable<Product> products)
        {
            string description = string.Empty;
            var adjustedValue =  discounter.ApplyDiscount(products.Sum(p => p.Price)
                //, out description
                );
            Console.WriteLine(description);
            return adjustedValue;
        }

        public LinqValueCalculator(IDiscountHelper discountParam)
        {
            discounter = discountParam;
        }

    }
}